﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Ras2ClassLib;

namespace Ras2
{
	public partial class ListDlg : Form
	{
		private SortOrder[] m_arrLastSortOrder = new SortOrder[(int)ListColumns.NumberOfColumns];

		private VinList m_vinList;

		public ListDlg()
		{
			InitializeComponent();
		}

		public VinList VinList
		{
			get { return m_vinList; }
			set { m_vinList = value; }
		}

		private ListViewItem GetListViewItem(VinListFaersla vinList)
		{
			ListViewItem item = new ListViewItem(Convert.ToString(vinList.Place));

			item.SubItems.Add(vinList.SongName);

			item.SubItems.Add(vinList.PerformerName);

			item.ImageIndex = 0;

			item.Tag = vinList;

			return item;
		}

		private void OnLoad(object sender, EventArgs e)
		{
			m_listView.Items.Clear();
			VinListFaerslaDoc doc = new VinListFaerslaDoc();
			VinListFaerslaCollection vinlists = doc.GetAllVinListFaersla(m_vinList.ID);

			foreach (VinListFaersla vinlist in vinlists)
			{
				m_listView.Items.Add(GetListViewItem(vinlist));
			}
			
		}
	}
}
